#include <iostream>
// 系统调用
 #include <pthread.h>
#include <sys/types.h>
#include <unistd.h>

void *start_routine(void *arguments) // arguments参数
{
    while (true)
    {
        sleep(1);
        std::cout << "new thread running..., pid:" << getpid() << std::endl;
    }
}
int main()
{
    pthread_t thread; // 线程唯一标识
    int result = pthread_create(&thread, nullptr, start_routine, (void *)"thread_new");
    if (result != 0) // 失败返回错误码
    {
        perror("pthread_create fail");
    }
    while (true)
    {
        std::cout << "main thread running..., pid:" << getpid() << std::endl;
        sleep(1);
    }

    return 0;
}